/*
 * AncherElement.h
 *
 *  Created on: 2010-6-6
 *      Author: guobc
 */

#ifndef ANCHERELEMENT_H_
#define ANCHERELEMENT_H_

#include "CommonElement.h"

namespace HA {
class AncherElement: public HA::CommonElement {
public:
	AncherElement();

	/**
	 * Get the set of names handles by this element.
	 * @return The names to be matched that create elements of this type.
	 */
	inline string* getIds() const {
		return mIds;
	}

	/**
	 * Return the set of name that cause this element to finish.
	 * @return The names of following elements that stop further parse.
	 */
	inline string* getEnders() const {
		return mEnds;
	}

	/**
	 * Return link url of this element.
	 * @return The value of HREF attribute.
	 */
	inline string getLink() {
		return getAttribute("HREF");
	}

	/**
	 * Set the value of HREF attribute.
	 * @param url The new value of HREF attribute.
	 */
	inline void setLink(const string& url) {
		setAttribute("HREF", url);
	}

	/**
	 * Allow creating an instance of this node.
	 * @return A new instance of this node.
	 */
	inline ASTNode* newInstance() {
		return new AncherElement();
	}

	/**
	 * Test whether a mail link.
	 * @return true/false.
	 */
	bool isMailLink();

	/**
	 * Test whether a javascript link.
	 * @return true/false.
	 */
	bool isJavascriptLink();

	/**
	 * Test whether a ftp link.
	 * @return true/false.
	 */
	bool isFTPLink();

	/**
	 * Test whether a IRC link.
	 * @return true/false.
	 */
	bool isIRCLink();

	/**
	 * Test whether a http link.
	 * @return true/false.
	 */
	bool isHTTPLink();

	/**
	 * Test whether a https link.
	 * @return true/false.
	 */
	bool isHTTPSLink();

private:
	static string mIds[];
	static string mEnds[];
};
}
#endif /* ANCHERELEMENT_H_ */
